package com.example.guethe.fireanalysisapp.fragments;

import com.example.guethe.fireanalysisapp.adapter.CatalogAdapter;
import com.example.guethe.fireanalysisapp.base.BaseHomeFragment;
import com.example.guethe.fireanalysisapp.data.beans.CataLog;
import com.example.guethe.fireanalysisapp.data.beans.Device;


import cn.droidlover.xdroidmvp.base.SimpleRecAdapter;

import cn.droidlover.xrecyclerview.RecyclerItemCallback;
import cn.droidlover.xrecyclerview.XRecyclerView;

/**
 * Created by 何建钦 on 2018/3/30.
 */

public class CatalogFragment extends BaseHomeFragment {
    CatalogAdapter adapter;

    @Override
    public SimpleRecAdapter getAdapter() {
        if (adapter == null) {
            adapter = new CatalogAdapter(context);
            adapter.setRecItemClick(new RecyclerItemCallback<CataLog, CatalogAdapter.ViewHolder>() {
                @Override
                public void onItemClick(int position, CataLog model, int tag, CatalogAdapter.ViewHolder holder) {
                    super.onItemClick(position, model, tag, holder);
                    switch (tag) {
                        case CatalogAdapter.TAG_VIEW:
//                            WebActivity.launch(context, model.getUrl(), model.getDesc());
                            break;
                    }
                }
            });
        }
        return adapter;
    }

    @Override
    public void setLayoutManager(XRecyclerView recyclerView) {
        recyclerView.verticalLayoutManager(context);
    }

    @Override
    public String getType() {
        return "";
    }

    public static CatalogFragment newInstance() {
        return new CatalogFragment();
    }
}
